﻿using Orleans;
using Orleans.Concurrency;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Puppy.CommonService
{
    /// <summary>
    /// 分布式ID生成服务
    /// </summary>
    public interface IIDGenerateActor : IGrainWithGuidKey
    {
        /// <summary>
        /// 通过utc时间生成分布式唯一id
        /// </summary>
        /// <returns></returns>
        [AlwaysInterleave]
        ValueTask<long> NewID();

        /// <summary>
        /// 批量生成ID
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        [AlwaysInterleave]
        ValueTask<IEnumerable<long>> NewIDBatch(int count);
    }
}
